-- define project
set_project("Petzold_Win32API")

-- set xmake min version
set_xmakever("2.8.2")

set_version("0.1.5", {build="%Y%m%d%H%M"})

add_extrafiles("readme.md")

set_encodings("source:utf-8") --msvc /utf8 since 2.8.2
add_defines("_CRT_SECURE_NO_WARNINGS")
-- windows平台使用msvc2022 IDE或者msvc build tools工具链, 因此注释下面的cxflags
-- windows x64 生成drawf调试信息的可执行文件, 而不是win平台的pdb
-- add_cxflags("-target x86_64-pc-windows-gnu")
-- windows下使用clang++,默认会链接msvc的头文件和库, 强制修改
-- add_ldflags("--target=x86_64-w64-mingw") 
add_includedirs("C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/atlmfc/include") 
add_includedirs("C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/um") 
add_includedirs("C:/Program Files (x86)/Windows Kits/10/Include/10.0.22621.0/shared") 
if is_arch("x86_64") then -- win11@x64
    add_linkdirs("C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x64")
end
if is_arch("i386") then -- win11@x86
    add_linkdirs("C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/x86")
end
if is_arch("arm.*") then  -- pd19@M1Mac
    add_linkdirs("C:/Program Files (x86)/Windows Kits/10/Lib/10.0.22621.0/um/arm64")
end
add_links("kernel32","user32","gdi32","winspool","winmm","comdlg32","advapi32","shell32","ole32","oleaut32","uuid","odbc32","odbccp32","ddraw", "comctl32")
--https://xmake.io/#/zh-cn/manual/project_target?id=targetset_languages 
set_languages("cxx20") 

-- set warning all as error
set_warnings("all", "error")

add_defines("_HAS_AUTO_PTR_ETC=0") -- std::binary_funcion removed since C++17
add_defines("dec_jizh=void")
add_includedirs("./WinGraphics/include")

-- add build modes
add_rules("mode.release", "mode.debug")

set_defaultmode("debug")
set_defaultplat("windows")


-- includes sub-projects
includes("petzold",
        "WinGraphics", -- KWinLib && Example code
        "DPIAwarenessPerWindow/client",
        "ReCaps"
        )

-- 注意: 对于每一个target, 如果不显式设定set_default(false), 则均为true
-- 如果xmake-vscode插件在状态栏的target=default,
-- 则F7编译的时候，所有target全部参与编译，默认情况下，所有的target都需要编译
-- 设定set_default(false)则可以修改这一点